package com.jzr.bedside.controller.api;

import com.jzr.bedside.db1.service.DoorSideService;
import com.jzr.bedside.db1.vo.DoorSideVo;
import com.jzr.common.entity.vo.Result;
import com.jzr.common.util.U;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/doorSide")
@Api(tags = "门旁接口")
public class DoorSideController {
    @Autowired
    private DoorSideService doorSideService;

    @ApiOperation(value="根据科室编号和房间号查询")
    @GetMapping("/getDoorSideInfo")
    public Result<DoorSideVo> getDoorSideInfo(@ApiParam("科室编号") String deptCode, @ApiParam("房间编号") String roomCode){
        if(U.isBlank(deptCode)){
            return Result.fail("deptCode不能为空");
        }
        if(U.isBlank(roomCode)){
            return Result.fail("roomCode不能为空");
        }
        DoorSideVo doorSideVo = doorSideService.getDoorSideInfo(deptCode,roomCode);

        return Result.success(doorSideVo);
    }
}
